package cn.asterly.cicada.web.controller;

import cn.asterly.cicada.common.model.DataTablesResult;
import cn.asterly.cicada.model.Sider;
import cn.asterly.cicada.service.impl.SiderServiceImpl;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/navsider")
public class SiderController {

    private static Logger logger=Logger.getRootLogger();

    @Autowired
    SiderServiceImpl siderService;

    @ResponseBody
    @RequestMapping(value = {"/selall"},method = RequestMethod.GET)
    public DataTablesResult selectByAll(){
        List<Sider> siders = siderService.selectByAll();
        DataTablesResult result = new DataTablesResult();
        result.setData(siders);
        result.setSuccess(true);
        result.setRecordsTotal(siders.size());
        return result;
    }

}
